package com.qf.shop.dao.Impl;

import com.qf.shop.dao.ManagerDao;
import com.qf.shop.entity.Manager;
import com.qf.shop.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class ManagerDaoImpl implements ManagerDao {
    @Override
    public Manager select(String username) {
        QueryRunner queryRunner = new QueryRunner();
        try {
            return  queryRunner.query(DruidUtils.getConnection(),"select * from manager where username = ?;",new BeanHandler<>(Manager.class),username);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
